Skip to content

MkTreeView

Show source on GitHub

Node to display tree structures.

Description

Currently supports directories and Node subclasses (including MkNodes).

Example: Different styles

Jinja

{{ "mknodes/manual" | MkTreeView }}

Python

MkTreeView('mknodes/manual')
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>📂 manual
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>┣━━ 📂 __pycache__
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
</span><span id="__span-0-10"><a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
</span><span id="__span-0-11"><a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
</span><span id="__span-0-12"><a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-13"><a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>┣━━ 🐍 __init__.py (43 Bytes)
</span><span id="__span-0-14"><a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>┣━━ 🐍 a_quick_tour.py (5.8 kB)
</span><span id="__span-0-15"><a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>┣━━ 🐍 dev_section.py (833 Bytes)
</span><span id="__span-0-16"><a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a>┣━━ 🐍 get_started_section.py (1.1 kB)
</span><span id="__span-0-17"><a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>┣━━ 🐍 github_index.py (608 Bytes)
</span><span id="__span-0-18"><a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a>┣━━ 🐍 navs_section.py (2.1 kB)
</span><span id="__span-0-19"><a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a>┣━━ 🐍 nodes_section.py (4.0 kB)
</span><span id="__span-0-20"><a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a>┣━━ 🐍 page_section.py (2.3 kB)
</span><span id="__span-0-21"><a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a>┣━━ 🐍 root.py (1.5 kB)
</span><span id="__span-0-22"><a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a>┣━━ 🐍 routing.py (1.1 kB)
</span><span id="__span-0-23"><a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a>┗━━ 🐍 templating_section.py (1.5 kB)
</span></code></pre></div>

Example: Style 'ansi'

Jinja

{{ "mknodes/manual" | MkTreeView(style="ansi") }}

Python

MkTreeView('mknodes/manual', style='ansi')
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>📂 manual
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>┣━━ 📂 __pycache__
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
</span><span id="__span-0-10"><a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
</span><span id="__span-0-11"><a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
</span><span id="__span-0-12"><a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-13"><a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>┣━━ 🐍 __init__.py (43 Bytes)
</span><span id="__span-0-14"><a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>┣━━ 🐍 a_quick_tour.py (5.8 kB)
</span><span id="__span-0-15"><a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>┣━━ 🐍 dev_section.py (833 Bytes)
</span><span id="__span-0-16"><a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a>┣━━ 🐍 get_started_section.py (1.1 kB)
</span><span id="__span-0-17"><a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>┣━━ 🐍 github_index.py (608 Bytes)
</span><span id="__span-0-18"><a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a>┣━━ 🐍 navs_section.py (2.1 kB)
</span><span id="__span-0-19"><a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a>┣━━ 🐍 nodes_section.py (4.0 kB)
</span><span id="__span-0-20"><a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a>┣━━ 🐍 page_section.py (2.3 kB)
</span><span id="__span-0-21"><a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a>┣━━ 🐍 root.py (1.5 kB)
</span><span id="__span-0-22"><a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a>┣━━ 🐍 routing.py (1.1 kB)
</span><span id="__span-0-23"><a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a>┗━━ 🐍 templating_section.py (1.5 kB)
</span></code></pre></div>

Example: Style 'ascii'

Jinja

{{ "mknodes/manual" | MkTreeView(style="ascii") }}

Python

MkTreeView('mknodes/manual', style='ascii')
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>📂 manual
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>┣━━ 📂 __pycache__
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
</span><span id="__span-0-10"><a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
</span><span id="__span-0-11"><a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
</span><span id="__span-0-12"><a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-13"><a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>┣━━ 🐍 __init__.py (43 Bytes)
</span><span id="__span-0-14"><a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>┣━━ 🐍 a_quick_tour.py (5.8 kB)
</span><span id="__span-0-15"><a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>┣━━ 🐍 dev_section.py (833 Bytes)
</span><span id="__span-0-16"><a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a>┣━━ 🐍 get_started_section.py (1.1 kB)
</span><span id="__span-0-17"><a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>┣━━ 🐍 github_index.py (608 Bytes)
</span><span id="__span-0-18"><a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a>┣━━ 🐍 navs_section.py (2.1 kB)
</span><span id="__span-0-19"><a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a>┣━━ 🐍 nodes_section.py (4.0 kB)
</span><span id="__span-0-20"><a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a>┣━━ 🐍 page_section.py (2.3 kB)
</span><span id="__span-0-21"><a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a>┣━━ 🐍 root.py (1.5 kB)
</span><span id="__span-0-22"><a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a>┣━━ 🐍 routing.py (1.1 kB)
</span><span id="__span-0-23"><a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a>┗━━ 🐍 templating_section.py (1.5 kB)
</span></code></pre></div>

Example: Style 'rounded'

Jinja

{{ "mknodes/manual" | MkTreeView(style="rounded") }}

Python

MkTreeView('mknodes/manual')
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>📂 manual
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>┣━━ 📂 __pycache__
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
</span><span id="__span-0-10"><a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
</span><span id="__span-0-11"><a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
</span><span id="__span-0-12"><a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-13"><a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>┣━━ 🐍 __init__.py (43 Bytes)
</span><span id="__span-0-14"><a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>┣━━ 🐍 a_quick_tour.py (5.8 kB)
</span><span id="__span-0-15"><a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>┣━━ 🐍 dev_section.py (833 Bytes)
</span><span id="__span-0-16"><a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a>┣━━ 🐍 get_started_section.py (1.1 kB)
</span><span id="__span-0-17"><a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>┣━━ 🐍 github_index.py (608 Bytes)
</span><span id="__span-0-18"><a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a>┣━━ 🐍 navs_section.py (2.1 kB)
</span><span id="__span-0-19"><a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a>┣━━ 🐍 nodes_section.py (4.0 kB)
</span><span id="__span-0-20"><a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a>┣━━ 🐍 page_section.py (2.3 kB)
</span><span id="__span-0-21"><a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a>┣━━ 🐍 root.py (1.5 kB)
</span><span id="__span-0-22"><a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a>┣━━ 🐍 routing.py (1.1 kB)
</span><span id="__span-0-23"><a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a>┗━━ 🐍 templating_section.py (1.5 kB)
</span></code></pre></div>

Example: Style 'spaces'

Jinja

{{ "mknodes/manual" | MkTreeView(style="spaces") }}

Python

MkTreeView('mknodes/manual', style='spaces')
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
📂 manual
┣━━ 📂 __pycache__
┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
┣━━ 🐍 __init__.py (43 Bytes)
┣━━ 🐍 a_quick_tour.py (5.8 kB)
┣━━ 🐍 dev_section.py (833 Bytes)
┣━━ 🐍 get_started_section.py (1.1 kB)
┣━━ 🐍 github_index.py (608 Bytes)
┣━━ 🐍 navs_section.py (2.1 kB)
┣━━ 🐍 nodes_section.py (4.0 kB)
┣━━ 🐍 page_section.py (2.3 kB)
┣━━ 🐍 root.py (1.5 kB)
┣━━ 🐍 routing.py (1.1 kB)
┗━━ 🐍 templating_section.py (1.5 kB)
````
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>📂 manual
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>┣━━ 📂 __pycache__
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>┃   ┣━━ 📄 __init__.cpython-312.pyc (208 Bytes)
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>┃   ┣━━ 📄 a_quick_tour.cpython-312.pyc (1.9 kB)
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>┃   ┣━━ 📄 dev_section.cpython-312.pyc (2.5 kB)
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>┃   ┣━━ 📄 get_started_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>┃   ┣━━ 📄 navs_section.cpython-312.pyc (3.9 kB)
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>┃   ┣━━ 📄 nodes_section.cpython-312.pyc (8.1 kB)
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>┃   ┣━━ 📄 page_section.cpython-312.pyc (5.0 kB)
</span><span id="__span-0-10"><a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>┃   ┣━━ 📄 root.cpython-312.pyc (3.1 kB)
</span><span id="__span-0-11"><a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>┃   ┣━━ 📄 routing.cpython-312.pyc (2.1 kB)
</span><span id="__span-0-12"><a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>┃   ┗━━ 📄 templating_section.cpython-312.pyc (2.8 kB)
</span><span id="__span-0-13"><a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>┣━━ 🐍 __init__.py (43 Bytes)
</span><span id="__span-0-14"><a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>┣━━ 🐍 a_quick_tour.py (5.8 kB)
</span><span id="__span-0-15"><a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>┣━━ 🐍 dev_section.py (833 Bytes)
</span><span id="__span-0-16"><a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a>┣━━ 🐍 get_started_section.py (1.1 kB)
</span><span id="__span-0-17"><a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>┣━━ 🐍 github_index.py (608 Bytes)
</span><span id="__span-0-18"><a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a>┣━━ 🐍 navs_section.py (2.1 kB)
</span><span id="__span-0-19"><a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a>┣━━ 🐍 nodes_section.py (4.0 kB)
</span><span id="__span-0-20"><a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a>┣━━ 🐍 page_section.py (2.3 kB)
</span><span id="__span-0-21"><a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a>┣━━ 🐍 root.py (1.5 kB)
</span><span id="__span-0-22"><a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a>┣━━ 🐍 routing.py (1.1 kB)
</span><span id="__span-0-23"><a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a>┗━━ 🐍 templating_section.py (1.5 kB)
</span></code></pre></div>

Bases: MkCode

__init__

__init__(
    tree: str | PathLike[str] | MkNode,
    *,
    style: TreeStyleStr | tuple[str, str, str, str] = "rounded",
    maximum_depth: int | None = None,
    predicate: Callable[..., bool] | None = None,
    exclude_folders: list[str] | str | None = None,
    **kwargs: Any
)

Parameters:

Name Type Description Default
tree str | PathLike[str] | MkNode

Tree to display. Can be a path to a folder or a Node.

required
style TreeStyleStr | tuple[str, str, str, str]

Print style. If tuple, parts are used for stems

'rounded'
maximum_depth int | None

Maximum nesting depth to print

None
predicate Callable[..., bool] | None

Predicate to filter results

None
exclude_folders list[str] | str | None

Folders to exclude from listing

None
kwargs Any

Keyword arguments passed to parent

{}
Name Children Inherits
MkCode
mknodes.basenodes.mkcode
Class representing a Code block.
graph TD
  94721312024000["mktreeview.MkTreeView"]
  94721306031680["mkcode.MkCode"]
  94721311697232["mkcontainer.MkContainer"]
  94721308848336["mknode.MkNode"]
  94721311766592["node.Node"]
  140564252373184["builtins.object"]
  94721306031680 --> 94721312024000
  94721311697232 --> 94721306031680
  94721308848336 --> 94721311697232
  94721311766592 --> 94721308848336
  140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/templatenodes/mktreeview/metadata.toml
[metadata]
icon = "mdi:file-tree-outline"
name = "MkTreeView"

[examples.regular]
title = "Different styles"
jinja = """
{{ "mknodes/manual" | MkTreeView }}
"""

[examples.ansi]
title = "Style 'ansi'"
jinja = """
{{ "mknodes/manual" | MkTreeView(style="ansi") }}
"""

[examples.ascii]
title = "Style 'ascii'"
jinja = """
{{ "mknodes/manual" | MkTreeView(style="ascii") }}
"""

[examples.rounded]
title = "Style 'rounded'"
jinja = """
{{ "mknodes/manual" | MkTreeView(style="rounded") }}
"""

[examples.spaces]
title = "Style 'spaces'"
jinja = """
{{ "mknodes/manual" | MkTreeView(style="spaces") }}
"""

# [examples.remote]
# title = "Files from a repote path"
# jinja = """
# {{ "github://" | MkTreeView(storage_options={"org": "mkdocstrings", "repo": "mkocstrings"}, maximum_depth=2) }}
# """

[output.markdown]
template = """
{{ node.fence_boundary }}
{% if node.tree is instance("os.PathLike") %}
{{ node.tree.get_tree_repr(style=node.style, max_depth=node.maximum_depth) }}{% else %}
{{ node.tree | get_directory_tree(max_depth=node.maximum_depth) }}
{% endif %}
{{ node.fence_boundary }}
"""
mknodes.templatenodes.mktreeview.MkTreeView
class MkTreeView(mkcode.MkCode):
    """Node to display tree structures.

    Currently supports directories and Node subclasses (including `MkNodes`).
    """

    ICON = "material/file-tree-outline"
    STATUS = "new"

    def __init__(
        self,
        tree: str | os.PathLike[str] | mknode.MkNode,
        *,
        style: treestyles.TreeStyleStr | tuple[str, str, str, str] = "rounded",
        maximum_depth: int | None = None,
        predicate: Callable[..., bool] | None = None,
        exclude_folders: list[str] | str | None = None,
        **kwargs: Any,
    ):
        """Constructor.

        Args:
            tree: Tree to display. Can be a path to a folder or a Node.
            style: Print style. If tuple, parts are used for stems
            maximum_depth: Maximum nesting depth to print
            predicate: Predicate to filter results
            exclude_folders: Folders to exclude from listing
            kwargs: Keyword arguments passed to parent
        """
        super().__init__(language="", **kwargs)
        self.tree = tree
        self.style = style
        self.predicate = predicate
        self.maximum_depth = maximum_depth
        self.exclude_folders = (
            [exclude_folders] if isinstance(exclude_folders, str) else exclude_folders
        )

    @property
    def text(self):
        match self.tree:
            case str() | os.PathLike():
                return filetree.get_directory_tree(
                    self.tree, max_depth=self.maximum_depth
                )
            case mknode.MkNode() as tree:
                return tree.get_tree_repr(style=self.style, max_depth=self.maximum_depth)
            case _:
                raise TypeError(self.tree)